1 /** 2 * This file is part of libphidget21 3 * 4 * Copyright 2006-2015 Phidgets Inc <patrick@phidgets.com> 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 3 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, see 18 * <http://www.gnu.org/licenses/> 19 */ 20 module phidget21.phidgets.phidifkit; 21 22 extern(C) __gshared { 23 struct _CPhidgetInterfaceKit; 24 alias CPhidgetInterfaceKitHandle = _CPhidgetInterfaceKit*; 25 26 int function(CPhidgetInterfaceKitHandle* phid) CPhidgetInterfaceKit_create; 27 28 /** 29 * Gets the number of digital inputs supported by tehis board. 30 * 31 * Params: 32 * phid = An attached phidget interface kit handle. 33 * count = The digital input count. 34 */ 35 int function(CPhidgetInterfaceKitHandle phid, int* count) CPhidgetInterfaceKit_getInputCount; 36 37 /** 38 * Gets the state of a digital input. 39 * 40 * Params: 41 * phid = An attached phidget interface kit handle. 42 * index = The input index. 43 * inputState = The input state. Possible values are PTRUE and PFALSE. 44 */ 45 int function(CPhidgetInterfaceKitHandle phid, int index, int* inputState) CPhidgetInterfaceKit_getInputState; 46 47 alias CPhidgetInterfaceKit_set_OnInputChange_Handler_Func = extern(C) int function(CPhidgetInterfaceKitHandle phid, void* userPtr, int index, int inputState); 48 /** 49 * Set a digital input change handler. This is called when a digital input changes. 50 * 51 * Params: 52 * phid = An attached phidget interface kit handle. 53 * fptr = Callback function pointer. 54 * userPtr = A pointer for use by the user - this value is passed back into the callback function. 55 */ 56 int function(CPhidgetInterfaceKitHandle phid, CPhidgetInterfaceKit_set_OnInputChange_Handler_Func fptr, void* userPtr) CPhidgetInterfaceKit_set_OnInputChange_Handler; 57 58 /** 59 * Gets the number of digital outputs supported by this board. 60 * 61 * Params: 62 * phid = An attached phidget interface kit handle. 63 * count = The output count. 64 */ 65 int function(CPhidgetInterfaceKitHandle phid, int* count) CPhidgetInterfaceKit_getOutputCount; 66 67 /** 68 * Gets the state of a digital output. 69 * 70 * Params: 71 * phid = An attached phidget interface kit handle. 72 * index = The output index. 73 * outputState = The output state. Possible values are PTRUE and PFALSE. 74 */ 75 int function(CPhidgetInterfaceKitHandle phid, int index, int* outputState) CPhidgetInterfaceKit_getOutputState; 76 77 /** 78 * Sets the state of a digital output. 79 * 80 * Params: 81 * phid = An attached phidget interface kit handle. 82 * index = The output index. 83 * outputState = The output state. Possible values are PTRUE and PFALSE. 84 */ 85 int function(CPhidgetInterfaceKitHandle phid, int index, int outputState) CPhidgetInterfaceKit_setOutputState; 86 87 alias CPhidgetInterfaceKit_set_OnOutputChange_Handler_Func = extern(C) int function(CPhidgetInterfaceKitHandle phid, void* userPtr, int index, int outputState); 88 /** 89 * Set a digital output change handler. This is called when a digital output changs. 90 * 91 * Params: 92 * phid = An attached phidget interface kit hadnle. 93 * fptr = Callback function pointer. 94 * userPtr = A pointer for use by the user - this value is passed back into the callback function. 95 */ 96 int function(CPhidgetInterfaceKitHandle phid, CPhidgetInterfaceKit_set_OnOutputChange_Handler_Func fptr, void* userPtr) CPhidgetInterfaceKit_set_OnOutputChange_Handler; 97 98 /** 99 * Gets the number of sensor (analog) inputs supported by this board. 100 * 101 * Params: 102 * phid = An attached phidget interface kit handle. 103 * count = The sensor input count. 104 */ 105 int function(CPhidgetInterfaceKitHandle phid, int* count) CPhidgetInterfaceKit_getSensorCount; 106 107 /** 108 * Gets a sensor value (0-1000). 109 * 110 * Params: 111 * phid = An attached phidget interface kit handle. 112 * index = The sensor index. 113 * sensorValue = The sensor value. 114 */ 115 int function(CPhidgetInterfaceKitHandle phid, int index, int* sensorValue) CPhidgetInterfaceKit_getSensorValue; 116 117 /** 118 * Gets a sensor raw value (12-bit). 119 * 120 * Params: 121 * phid = An attached phidget interface kit handle. 122 * index = The sensor index. 123 * sensorRawValue = The sensor value. 124 */ 125 int function(CPhidgetInterfaceKitHandle phid, int index, int* sensorRawValue) CPhidgetInterfaceKit_getSensorRawValue; 126 127 alias CPhidgetInterfaceKit_set_OnSensorChange_Handler_Func = extern(C) int function(CPhidgetInterfaceKitHandle phid, void* userPtr, int index, int sensorValue); 128 /** 129 * Set a sensor change handler. This is called when a sensor value changes by more then the change trigger. 130 * 131 * Params: 132 * phid = An attached phidget interface kit handle. 133 * fptr = Callback function pointer. 134 * userPtr = A pointer for use by the user - this value is passed back into the callback function. 135 */ 136 int function(CPhidgetInterfaceKitHandle phid, CPhidgetInterfaceKit_set_OnSensorChange_Handler_Func fptr, void* userPtr) CPhidgetInterfaceKit_set_OnSensorChange_Handler; 137 138 /** 139 * Gets a sensor change trigger. 140 * 141 * Params: 142 * phid = An attached phidget interface kit handle. 143 * index = The sensor index. 144 * trigger = The change trigger. 145 */ 146 int function(CPhidgetInterfaceKitHandle phid, int index, int* trigger) CPhidgetInterfaceKit_getSensorChangeTrigger; 147 148 /** 149 * Sets a sensor change trigger. 150 * 151 * Params: 152 * phid = An attached phidget interface kit handle. 153 * index = The sensor index. 154 * trigger = The change trigger. 155 */ 156 int function(CPhidgetInterfaceKitHandle phid, int index, int trigger) CPhidgetInterfaceKit_setSensorChangeTrigger; 157 158 /** 159 * Gets the ratiometric state for this board. 160 * 161 * Params: 162 * phid = An attached phidget interface kit handle. 163 * ratiometric = The ratiometric state. Possible values are PTRUE and PFALSE. 164 */ 165 int function(CPhidgetInterfaceKitHandle phid, int* ratiometric) CPhidgetInterfaceKit_getRatiometric; 166 167 /** 168 * Sets the ratiometric state for this board. 169 * 170 * Params: 171 * phid = An attached phidget interface kit handle. 172 * ratiometric = The ratiometric state. Possible values are PTRUE and PFALSE. 173 */ 174 int function(CPhidgetInterfaceKitHandle phid, int ratiometric) CPhidgetInterfaceKit_setRatiometric; 175 176 /** 177 * Gets the Data rate for an analog input. 178 * 179 * Params: 180 * phid = An attached phidget interface kit handle. 181 * index = The sensor index. 182 * milliseconds = Data rate in ms. 183 */ 184 int function(CPhidgetInterfaceKitHandle phid, int index, int* milliseconds) CPhidgetInterfaceKit_getDataRate; 185 186 /** 187 * Sets the Data Rate for an analog input. 188 * 189 * Params: 190 * phid = An attached phidget interface kit handle. 191 * index = The sensor index. 192 * milliseconds = Data rate in ms. 193 */ 194 int function(CPhidgetInterfaceKitHandle phid, int index, int milliseconds) CPhidgetInterfaceKit_setDataRate; 195 196 /** 197 * Gets the maximum supported data rate for an analog input. 198 * 199 * Params: 200 * phid = An attached phidget interface kit handle. 201 * index = The sensor index. 202 * max = Data rate in ms. 203 */ 204 int function(CPhidgetInterfaceKitHandle phid, int index, int* max) CPhidgetInterfaceKit_getDataRateMax; 205 206 /** 207 * Gets the minimum supported data rate for an analog input. 208 * 209 * Params: 210 * phid = An attached phidget interface kit handle. 211 * index = The sensor index. 212 * min = Data rate in ms. 213 */ 214 int function(CPhidgetInterfaceKitHandle phid, int index, int* min) CPhidgetInterfaceKit_getDataRateMin; 215 }